02. An Example of Grid vs Flexbox

Grid vs Flexbox Example Prep

An Example of Grid vs Flexbox

An excellent way to use flexbox and grid together is by creating the layout of a webpage with grid and then organizing the flow of the content with flex. Let's see an example of this!

ND001 C01 L04 02 Grid Vs Flexbox Example

Grid vs Flexbox Example Summary

To use CSS Grid set the display property of the container element to grid.

Grid vs Flexbox Graphic

Flexbox can work within Grid

Flexbox can work within Grid

Grid vs Flexbox Quiz

Do you need to use either Flexbox or CSS Grid, and not the other, for an individual web project?

SOLUTION: CSS Grid and Flexbox work together

Grid vs Flexbox+

Recap

CSS Grid v. Flexbox

  • Grid is two dimensional, while Flex is one
  • Grid is layout first, while Flexbox is content first
  • Flex is for components of an app, Grid is for the app layout itself

Grid vs Flexbox Summary

CSS Grid does not replace Flexbox. Each can achieve things that the other is not capable of, and in fact, a true master can use Flexbox and CSS Grid together in harmony to create the ultimate webpage layout.

At the highest level CSS Grid excels at creating layouts for a webpage, while Flexbox is a master of content flow for each element that makes up the page layout.

Grid vs Flexbox Further Research

Further Research

For more information on CSS Grid and Flexbox together see the articles below: